package org.syh.boyangfighthealthclub.controller;

import org.syh.boyangfighthealthclub.entity.Book;
import org.syh.boyangfighthealthclub.entity.User;
import org.syh.boyangfighthealthclub.service.IBookService;
import org.syh.boyangfighthealthclub.service.IUserService;
import org.syh.boyangfighthealthclub.service.impl.BookServiceImpl;
import org.syh.boyangfighthealthclub.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: Ben
 * @Date: 2021/3/11 19:40
 */
@WebServlet("/admin/selectUpdateBook")
public class SelectUpdateBook extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;utf-8");
        Integer id= Integer.parseInt(req.getParameter("id"));
        IBookService iBookService=new BookServiceImpl();
        Book book=iBookService.selectBookById(id);
        req.setAttribute("book",book);
        req.getRequestDispatcher("../updateBook.jsp").forward(req,resp);
    }
}
